var  WebSocket = require('ws');
var ws = new WebSocket('wss://localhost:6002/', {
 protocolVersion: 8,
 origin: 'https://localhost:6002',
 rejectUnauthorized: false, //重要，自签名证书只能这样设了。CA颁发的受信任证书就不需要了
 perMessageDeflate: false
});
ws.on('open', function open() {
  console.log('connected');
  setTimeout(function() {
    ws.send('789');
  },10000)
});
ws.on('message', function(msg) {
  console.log(msg);
})
